package test;

import java.io.File;
import java.util.LinkedList;

public class ConfigReader {
	private String strfile = "e:/config.dll";
	private FileReader fr = null;
	private LinkedList<File> ll = new LinkedList<File>();
	private File file= null;
	
	public ConfigReader() {
		this.file = new File(strfile);
	};
	
	public ConfigReader(String file) {
		this.file = new File(file);
	}
	
	public ConfigReader(File file) {
		this.file = file;
	}
	
	public LinkedList<File> getFiles() {
		return getFiles(file);
	}
	
	public LinkedList<File> getFiles(String file) {
		return getFiles(new File(file));
	}
	
	public LinkedList<File> getFiles(File file) {
		fr = new FileReader(file);
		
		String line = null;
		while((line=fr.getNextLine())!=null) {
			line = line.trim();
			if(line.equals("")) continue;
			if(line.charAt(0)=='#') {
				System.out.println(line);
			}else {
				ll.addLast(new File(line));
			}
		}
		return ll;
	}
	public static void main(String[] args) {
		ConfigReader cr = new ConfigReader("e:/config.txt");
		cr.getFiles();
	}
}
